package cn.itsource.zcn.searchmastermessage.mapper;

import cn.itsource.zcn.org.domain.Shop;
import cn.itsource.zcn.searchmastermessage.domain.SearchMasterMessage;
import cn.itsource.zcn.searchmastermessage.query.SearchMasterMessageQuery;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * (SearchMasterMessage)表数据库访问层
 *
 * @author makejava
 * @since 2021-08-22 16:58:51
 */
public interface SearchMasterMessageMapper {

    /**
     * 新增数据
     *
     * @param tSearchMasterMessage 实例对象
     */
    @Insert("insert into t_search_master_message" +
            "(name,price,age,gender,coat_color,resources,pet_type,address,state,title,user_id,shop_id)" +
            "values (#{name},#{price},#{age},#{gender},#{coat_color},#{resources},#{pet_type},#{address},#{state},#{title},#{user_id},#{shop_id})")
    void save(SearchMasterMessage tSearchMasterMessage);

    /**
     * 修改数据
     *
     * @param tSearchMasterMessage 实例对象
     */
    @Update("update t_search_master_message set " +
            "name=#{name},price=#{price},age=#{age},gender=#{gender},coat_color=#{coat_color},resources=#{resources},pet_type=#{pet_type},address=#{address},state=#{state},title=#{title},user_id=#{user_id},shop_id=#{shop_id} " +
            "where id = #{id}")
    void update(SearchMasterMessage tSearchMasterMessage);

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     */
    @Delete("delete from t_search_master_message where id = #{id} ")
    void delete(Long id);


    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Select("select * from t_search_master_message where id = #{id}")
    SearchMasterMessage queryById(Long id);

    /**
     * 查询全部
     *
     * @return 对象列表
     */
    @Select("select * from t_search_master_message")
    List<SearchMasterMessage> queryAll();

    /**
     * 批量新增数据（MyBatis原生foreach方法）
     *
     * @param entities List<SearchMasterMessage> 实例对象列表
     */
    void insertBatch(@Param("SearchMasterMessages") List<SearchMasterMessage> entities);

    /**
     * 批量删除数据（MyBatis原生foreach方法）
     *
     * @param ids List<Integer> 实例对象列表
     */
    void deleteBatch(@Param("ids") List<Integer> ids);


    Integer count(SearchMasterMessageQuery searchMasterMessageQuery);

    List<SearchMasterMessage> page(SearchMasterMessageQuery searchMasterMessageQuery);
}

